

// 混入 (mixin) 提供了一种非常灵活的方式，来分发 Vue 组件中的可复用功能
// 代码复用  
// 一个混入对象可以包含任意组件选项  (data methods mounted created filter computed watch ... )
// 当组件使用混入对象时，所有混入对象的选项将被“混合”进入该组件本身的选项 

// 全局混入和局部混入 
import Vue from 'vue'
import { mapState, mapActions, mapMutations, mapGetters } from 'vuex'
import { FootList } from './index'
import { reg } from './validate'
import { showSuccessMsg, showErrorMsg } from '@/api/request'

Vue.mixin({
    data() {
        return {
            wh2112: '勇敢牛牛，不怕困难，冲呀!',
            aaa: 'Are you OK?',
            FootList,
            reg
        }
    },
    computed: {
        ...mapState(['cartNum', 'city', 'cityList', 'userInfo', 'cinemaList', 'goodList']),
        ...mapGetters(['hotCity', 'typeList'])
    },
    filters: {

    },
    methods: {
        ...mapMutations(['changeCity', 'changeCityList', 'changeUserInfo']),
        ...mapActions(['changeCountAction', 'getCinemaList', 'getGoodListAction']), // this.$store.dispatch
        gotowhere() {

        },
        gotopage(name) { // 点击跳转
            this.$router.push({name})
        },
        showSuccessMsg,
        showErrorMsg,
    },
    mounted() {
        // console.log('这是全局混入的 mounted ')
    },
    destroyed() {
        
    },
    components: {

    }
})